﻿using DBServer.Selenium.Extenium.Path;
using Selenium;

namespace DBServer.Selenium.Extenium.Fixtures
{
    public class TabFixture : ExtComponentFixture
    {
        private readonly int _index;

        public TabFixture(ISelenium driver, IPath path, int index) : base (driver, path)
        {
            _index = index;
        }

        public TabFixture Select()
        {
            SafeExec(Path.Eval() + ".setActiveTab(" + _index + ")");
            return this;
        }

        public TabFixture Close()
        {
            SafeExec(Path.Eval() + ".remove(" + _index + ")");
            return this;
        }
    }
}